/**
* Copyright (C) 2018-2021
* All rights reserved, Designed By www.yixiang.co
* 注意：
* 本软件为www.yixiang.co开发研制，未经购买不得使用
* 购买后可获得全部源代码（禁止转卖、分享、上传到码云、github等开源平台）
* 一经发现盗用、分享等行为，将追究法律责任，后果自负
*/
package co.yixiang.modules.template.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

/**
* @author hupeng
* @date 2020-06-29
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@TableName("yx_shipping_templates_region")
public class YxShippingTemplatesRegion implements Serializable {

    /** 编号 */
    @TableId
    private Integer id;


    /** 省ID */
    @NotNull
    private Integer provinceId;


    /** 模板ID */
    @NotNull
    private Integer tempId;


    /** 城市ID */
    @NotNull
    private Integer cityId;


    /** 首件 */
    @NotNull
    private BigDecimal first;


    /** 首件运费 */
    @NotNull
    private BigDecimal firstPrice;


    /** 续件 */
    @NotNull
    private BigDecimal continues;


    /** 续件运费 */
    @NotNull
    private BigDecimal continuePrice;


    /** 计费方式 */
    @NotNull
    private Integer type;


    /** 分组唯一值 */
    @NotBlank
    private String uniqid;

    public static YxShippingTemplatesRegionBuilder builder() {
        return new YxShippingTemplatesRegionBuilder();
    }


    public void copy(YxShippingTemplatesRegion source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

    public static class YxShippingTemplatesRegionBuilder {
        private Integer id;
        private @NotNull Integer provinceId;
        private @NotNull Integer tempId;
        private @NotNull Integer cityId;
        private @NotNull BigDecimal first;
        private @NotNull BigDecimal firstPrice;
        private @NotNull BigDecimal continues;
        private @NotNull BigDecimal continuePrice;
        private @NotNull Integer type;
        private @NotBlank String uniqid;

        YxShippingTemplatesRegionBuilder() {
        }

        public YxShippingTemplatesRegionBuilder id(Integer id) {
            this.id = id;
            return this;
        }

        public YxShippingTemplatesRegionBuilder provinceId(@NotNull Integer provinceId) {
            this.provinceId = provinceId;
            return this;
        }

        public YxShippingTemplatesRegionBuilder tempId(@NotNull Integer tempId) {
            this.tempId = tempId;
            return this;
        }

        public YxShippingTemplatesRegionBuilder cityId(@NotNull Integer cityId) {
            this.cityId = cityId;
            return this;
        }

        public YxShippingTemplatesRegionBuilder first(@NotNull BigDecimal first) {
            this.first = first;
            return this;
        }

        public YxShippingTemplatesRegionBuilder firstPrice(@NotNull BigDecimal firstPrice) {
            this.firstPrice = firstPrice;
            return this;
        }

        public YxShippingTemplatesRegionBuilder continues(@NotNull BigDecimal continues) {
            this.continues = continues;
            return this;
        }

        public YxShippingTemplatesRegionBuilder continuePrice(@NotNull BigDecimal continuePrice) {
            this.continuePrice = continuePrice;
            return this;
        }

        public YxShippingTemplatesRegionBuilder type(@NotNull Integer type) {
            this.type = type;
            return this;
        }

        public YxShippingTemplatesRegionBuilder uniqid(@NotBlank String uniqid) {
            this.uniqid = uniqid;
            return this;
        }

        public YxShippingTemplatesRegion build() {
            return new YxShippingTemplatesRegion(id, provinceId, tempId, cityId, first, firstPrice, continues, continuePrice, type, uniqid);
        }

        public String toString() {
            return "YxShippingTemplatesRegion.YxShippingTemplatesRegionBuilder(id=" + this.id + ", provinceId=" + this.provinceId + ", tempId=" + this.tempId + ", cityId=" + this.cityId + ", first=" + this.first + ", firstPrice=" + this.firstPrice + ", continues=" + this.continues + ", continuePrice=" + this.continuePrice + ", type=" + this.type + ", uniqid=" + this.uniqid + ")";
        }
    }
}
